import Vue from "vue";
import VueRouter from "vue-router";
//登录
import Login from "@/views/login/Login.vue";
import AdminLogin from "@/views/login/AdminLogin.vue";
import LoginVitalityLogin from "@/views/login/VitalityLogin.vue";

// 主页
import Admin from "@/components/index/Admin.vue";
import Boss from "@/components/index/Boss.vue";
import CustomerService from "@/components/index/CustomerService.vue";
import Finance from "@/components/index/Finance.vue";
import Playmate from "@/components/index/Playmate.vue";
import Tenant from "@/components/index/Tenant.vue";

//数据页面
//-------------admin管理员-------------------
import AccompanyingManagement from "@/views/admin/AccompanyingManagement.vue";
import AdminHome from "@/views/admin/AdminHome.vue";
import BossManagement from "@/views/admin/BossManagement.vue";
import CustomerServiceManagement from "@/views/admin/CustomerServiceManagement.vue";
import FinancialManagement from "@/views/admin/FinancialManagement.vue";
import GameList from "@/views/admin/GameList.vue";
import LevelManagement from "@/views/admin/LevelManagement.vue";
import MembershipManagement from "@/views/admin/MembershipManagement.vue";
import OrderManagement from "@/views/admin/OrderManagement.vue";
import PunishmentRuleConfiguration from "@/views/admin/PunishmentRuleConfiguration.vue";
import RevenueStatistics from "@/views/admin/RevenueStatistics.vue";
import ServicePriceConfiguration from "@/views/admin/ServicePriceConfiguration.vue";
import SettlementRatioConfiguration from "@/views/admin/SettlementRatioConfiguration.vue";

//-------------boss玩家-------------------
import AccountRecharge from "@/views/boss/AccountRecharge.vue";
import ConsumptionRecord from "@/views/boss/ConsumptionRecord.vue";
import MyOrder from "@/views/boss/MyOrder.vue";
import PersonalCenter from "@/views/boss/PersonalCenter.vue";
import PlayHall from "@/views/boss/PlayHall.vue";
import RankingList from "@/views/boss/RankingList.vue";

//-------------customerService客服-------------------
import AfterSales from "@/views/customerService/AfterSales.vue";
import BossList from "@/views/customerService/BossList.vue";
import OrderList from "@/views/customerService/OrderList.vue";
import OrderProcessing from "@/views/customerService/OrderProcessing.vue";
import PlaymateInfo from "@/views/customerService/PlaymateInfo.vue";
import PlaymateList from "@/views/customerService/PlaymateList.vue";

//-------------finance财务-------------------
import AllBossFlowRecord from "@/views/finance/AllBossFlowRecord.vue";
import AllPlaymateFlowRecord from "@/views/finance/AllPlaymateFlowRecord.vue";
import BossRecharge from "@/views/finance/BossRecharge.vue";
import FindBoss from "@/views/finance/FindBoss.vue";
import FindPlaymate from "@/views/finance/FindPlaymate.vue";
import PlatformReports from "@/views/finance/PlatformReports.vue";
import PlaymateWithdrawal from "@/views/finance/PlaymateWithdrawal.vue";

//-------------playmate陪玩-------------------
import ApplyWithdrawal from "@/views/playmate/ApplyWithdrawal.vue";
import MyOrderRecord from "@/views/playmate/MyOrderRecord.vue";
import PlaceAnOrder from "@/views/playmate/PlaceAnOrder.vue";
import PlaymateCenter from "@/views/playmate/PlaymateCenter.vue";
import PlaymateFlowRecord from "@/views/playmate/PlaymateFlowRecord.vue";
import WithdrawalRecord from "@/views/playmate/WithdrawalRecord.vue";
import PlayPlayHall from "@/views/playmate/PlayPlayHall.vue";

//-------------tenant租户-------------------

// 重复点击不报错
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/boss",
  },
  {
    path: "/login",
    component: Login,
  },
  {
    path: "/adminLogin",
    component: AdminLogin,
  },
  {
    path: "/loginVitalityLogin",
    component: LoginVitalityLogin,
  },
  // 管理员
  {
    path: "/admin",
    component: Admin,
    children: [
      { path: "accompanyingManagement", component: AccompanyingManagement },
      { path: "adminHome", component: AdminHome },
      { path: "bossManagement", component: BossManagement },
      {
        path: "customerServiceManagement",
        component: CustomerServiceManagement,
      },
      { path: "financialManagement", component: FinancialManagement },
      { path: "gameList", component: GameList },
      { path: "levelManagement", component: LevelManagement },
      { path: "membershipManagement", component: MembershipManagement },
      { path: "orderManagement", component: OrderManagement },
      {
        path: "punishmentRuleConfiguration",
        component: PunishmentRuleConfiguration,
      },
      { path: "revenueStatistics", component: RevenueStatistics },
      {
        path: "servicePriceConfiguration",
        component: ServicePriceConfiguration,
      },
      {
        path: "settlementRatioConfiguration",
        component: SettlementRatioConfiguration,
      },
    ],
  },
  //玩家
  {
    path: "/boss",
    component: Boss,
    children: [
      {
        path: "/",
        component: PlayHall,
      },
      {
        path: "playHall",
        component: PlayHall,
      },
      { path: "accountRecharge", component: AccountRecharge },
      { path: "consumptionRecord", component: ConsumptionRecord },
      { path: "myOrder", component: MyOrder },
      { path: "personalCenter", component: PersonalCenter },
      { path: "playHall", component: PlayHall },
      { path: "rankingList", component: RankingList },
    ],
  },
  //客服
  {
    path: "/customerService",
    component: CustomerService,
    children: [
      { path: "afterSales", component: AfterSales },
      { path: "bossList", component: BossList },
      { path: "orderList", component: OrderList },
      { path: "orderProcessing", component: OrderProcessing },
      { path: "playmateInfo", component: PlaymateInfo },
      { path: "playmateList", component: PlaymateList },
    ],
  },
  //财务
  {
    path: "/finance",
    component: Finance,
    children: [
      { path: "allBossFlowRecord", component: AllBossFlowRecord },
      { path: "allPlaymateFlowRecord", component: AllPlaymateFlowRecord },
      { path: "bossRecharge", component: BossRecharge },
      { path: "findBoss", component: FindBoss },
      { path: "findPlaymate", component: FindPlaymate },
      { path: "platformReports", component: PlatformReports },
      { path: "playmateWithdrawal", component: PlaymateWithdrawal },
      { path: "rankingList", component: RankingList },
    ],
  },
  //陪玩
  {
    path: "/playmate",
    component: Playmate,
    children: [
      {
        path: "/",
        component: PlayHall,
      },
      { path: "playPlayHall", component: PlayPlayHall },
      { path: "applyWithdrawal", component: ApplyWithdrawal },
      { path: "myOrderRecord", component: MyOrderRecord },
      { path: "placeAnOrder", component: PlaceAnOrder },
      { path: "PlaymateCenter", component: PlaymateCenter },
      { path: "playmateFlowRecord", component: PlaymateFlowRecord },
      { path: "WithdrawalRecord", component: WithdrawalRecord },
      { path: "playHall", component: PlayHall },
      { path: "rankingList", component: RankingList },
    ],
  }, //租户
  {
    path: "/tenant",
    component: Tenant,
    children: [
      {
        //租户管理首页
        path: "/tenant/tenantIndex",
        name: "TenantIndex",
        component: () => import("@/views/tenant/TenantIndex.vue"),
      },
      {
        //添加新租户页面
        path: "/tenant/addTenant",
        name: "AddTenant",
        component: () => import("@/views/tenant/AddTenant.vue"),
      },
      //查询过期租户页面
      {
        path: "/tenant/TenantExpired",
        name: "TenantExpired",
        component: () => import("@/views/tenant/TenantExpired.vue"),
      },
    ],
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
